{% extends "flow-base.html" %}
{% block flow_header %}
<link rel="stylesheet" media="screen,projection" type="text/css" href="/static/css/jquery-ui-1.8.11.custom.css" />
<script type="text/javascript" src="/static/js/jquery-ui-1.8.11.custom.min.js"></script>

<script type="text/javascript">
$(document).ready(function(){

    $(".form-row :input").attr( {readOnly:'readOnly'});
    $(".form-row :input").css({"background-color": "white"});
    //$("#dialag").dialog();
});

function goback(){
$("#dialog").dialog({height:300,
                    width:500,
                    modal: true,  
                    buttons:{"确认": function(){ 
            var data = $('#goback_info').val();
            var id = $("input[name=tid]").val();
            if( !data ){ alert ("请输入打回理由"); return; };                 
		    $.post("/flow/ajax_goback/", {'id': id,'data':data},function(info){
			    if(info == 'true'){
                   $(this).dialog("close");
                   window.location.href = '/flow/';
                }else{
                   $(this).dialog("close");
                    alert("打回失败"); 
                }
			});},
                "取消":function(){ $(this).dialog("close"); },
                            },
   });
}

function opreplay(){
$("#dialog").dialog({height:400,
                    width:600,
                    modal: true,  
                    title:'操作CHECKLIST',
                    buttons:{"确认": function(){ 
            var data = $('#goback_info').val();
            var id = $("input[name=tid]").val();
            if( !data ){ alert ("请输入CHECKLIST!"); return; };                 
		    $.post("/flow/ajax_opreplay/", {'id': id,'data':data},function(info){
			    if(info == 'true'){
                    document.myform.submit();
                   $(this).dialog("close");
                }else{
                   $(this).dialog("close");
                    alert("打回失败"); 
                }
			});},
                "取消":function(){ $(this).dialog("close"); },
                            },
   });
}

</script>

{% endblock %}


{% block flow_title %}
操作任务 
{% endblock %} 

{%block task_action %}
<div id="dialog" title="打回理由" style="display:none">
            <textarea id="goback_info" name="detail" style="width:95%;height:90%" class="vLargeTextField"></textarea>
        </div>
        <div style='text-align:center'>
            <button type="button" style="margin-right:40px;width:80px" onclick="goback()" >打回修改</button>
            <button type="button" style="margin-right:40px;width:80px" onclick="opreplay()" >操作成功</button>
            <!--<input type="submit" value="操作成功"  style="margin-right:40px;width:80px" onclick="opreplay()" /> -->
        </div>

{% endblock %}
  
